def solution(dna_sequence):
    """
    # 此方法的时间复杂度为O(n)
    :param dna_sequence:
    :return:
    """
    # Please write your code here
    n = len(dna_sequence)
    # 初始化最小序列为输入的原始序列
    min_sequence = dna_sequence
    # 临时变量用于存储当前正在比较的循环移位后的序列
    temp = dna_sequence
    for _ in range(n):
        # 进行循环移位操作，将第一个字符移到末尾
        temp = temp[1:] + temp[0]
        # 如果当前循环移位后的序列比当前最小序列字典序小
        if temp < min_sequence:
            # 更新最小序列为当前循环移位后的序列
            min_sequence = temp
    # 返回最小表示的序列
    return min_sequence


def complex_solution(dna_sequence):
    """
    # 此方法的时间复杂度为O(n*n)
    :param dna_sequence:
    :return:
    """
    # Please write your code here
    n = len(dna_sequence)
    candidate_sequences = [dna_sequence[i:] + dna_sequence[:i] for i in range(n)]
    return min(candidate_sequences)


if __name__ == "__main__":
    #  You can add more test cases here
    print(solution("ATCA") == "AATC")
    print(solution("CGAGTC") == "AGTCCG")
    print(solution("TCATGGAGTGCTCCTGGAGGCTGAGTCCATCTCCAGTAG") == "AGGCTGAGTCCATCTCCAGTAGTCATGGAGTGCTCCTGG")
